package com.yonyou.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author wangchu
 * @param <T>
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class LayuiPageModel<T> {

    /**
     * 状态码
     */
    private String code = "0";

    /**
     * 消息
     */
    private String msg = "";

    /**
     * 数量
     */
    private long count;

    /**
     * 页数
     */
    private long page;

    /**
     *
     */
    private long totlePage;

    /**
     * 每页数量
     */
    private long limit;

    /**
     * 数据列表
     */
    private List<T> data;

    private Map<String, Object> totalRow;



    public static LayuiPageModel<?> success() {
        return new LayuiPageModel<>();
    }

    private Map<String, Object> other = new HashMap<>();

    public LayuiPageModel<T> setOther(String key, Object value) {
        this.other.put(key, value);
        return this;
    }

    public Map<String, Object> getOther() {
        return other;
    }
}